<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>v-model结合select使用</title>
  </head>
  <body>
    <div id="app">
      <!-- 选择一个 -->
      <select name="friuits" id="" v-model="fruit">
        <option value="苹果">苹果</option>
        <option value="葡萄">葡萄</option>
        <option value="柠檬">柠檬</option>
        <option value="荔枝">荔枝</option>
        <option value="哈密瓜">哈密瓜</option>
      </select>
      <h4>您选择的水果是：{{fruit}}</h4>
      <!-- 多选 -->
      <select name="friuits" id="" v-model="fruit" multiple>
        <option value="苹果">苹果</option>
        <option value="葡萄">葡萄</option>
        <option value="柠檬">柠檬</option>
        <option value="荔枝">荔枝</option>
        <option value="哈密瓜">哈密瓜</option>
      </select>
      <h4>您选择的水果是：{{fruits}}</h4>
      <!-- 值绑定 -->
      <label v-for="item in originFruits">
        <input type="checkbox" :value="item" v-model="myfruit" />{{item}}
      </label>
      <h4>您选择的水果是：{{myfruit}}</h4>
    </div>
    <script src="../vue.js"></script>
    <script>
      const app = new Vue({
        el: "#app",
        data: {
          message: "hello",
          fruit: "葡萄",
          fruits: "葡萄",
          myfruit: [],
          originFruits: ["苹果", "葡萄", "柠檬", "荔枝", "哈密瓜"],
        },
      });
    </script>
  </body>
</html>
